package controller;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import service.HospitalService;
import util.MessageUtil;
import util.ReturnResultUtil;

/**
 * Created by gable on 2018/5/17.
 */
@Controller
public class HospitalController {

    private final Log logger = LogFactory.getLog(this.getClass());

    @Autowired
    HospitalService hospitalService;

    @RequestMapping(value = "hospitals",method = RequestMethod.POST)
    @ResponseBody
    public ReturnResultUtil queryHospitals(){
       try {
           return hospitalService.queryHospitals();
       }catch (Exception e){
           e.printStackTrace();
           logger.error("/hospitals接口查询异常");
           return new ReturnResultUtil(0, MessageUtil.ERROR);
       }
    }

}
